![]() |
PATH![]() |
![]() ![]() |
There are two types of subroutines: those with labeled parameters and those with positional parameters.
For example, the following statement calls a subroutine with positional parameters.
minimumValue(150, 4000)
The following statement calls a subroutine with a labeled parameter. The searchFiles routine is defined in Examples of Subroutines With Labeled Parameters. The direct parameter is the list of filenames. The string to search for, "LeChateau", is the labeled parameter.
searchFiles of {"March Expenses", "April Expenses", ¬
"May Expenses", "June Expenses"} for "LeChateau"
The definition for a subroutine determines what kind of parameters the subroutine requires. When you call a subroutine, you must list its parameters in the same way they are specified in the subroutine definition.
You can also have subroutines with no parameters. To indicate that a subroutine has no parameters, you must include a pair of empty parentheses after the subroutine name in both the subroutine definition and the subroutine call. For example, the following script shows the definition and subroutine call for a subroutine called helloWorld that has no parameters.
on helloWorld()
display dialog "Hello World"
end
helloWorld()